package cloud.xiangyixiang.www.spring.boot.java.basics.utils;

import cloud.xiangyixiang.www.spring.boot.java.basics.annotations.TestAnnotation;

/**
 * <p>
 * 反射通过注解获取
 * </p>
 *
 * @author weixin
 * @date 2023/9/7 15:53
 */
@TestAnnotation
public class ReflectiveGetAnnotation {


    public static void main(String[] args) {
        boolean hasAnnotation = ReflectiveGetAnnotation.class.isAnnotationPresent(TestAnnotation.class);
        if(hasAnnotation){
            TestAnnotation testAnnotation = ReflectiveGetAnnotation.class.getAnnotation(TestAnnotation.class);
            System.out.println("id:"+testAnnotation.id());
            System.out.println("msg:"+testAnnotation.msg());
        }
    }

}
